package com.itheima1.controller;


import com.itheima.common.entity.Result;
import com.itheima1.pojo.Member;
import com.itheima1.pojo.MemberDTO;
import com.itheima1.pojo.MemberVO;
import com.itheima1.service.IOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 博~
 * @since 2024-12-23
 */
@RestController
@RequestMapping("/order")
@Api(tags = "预约管理")
public class OrderController {
    @Autowired
    private IOrderService orderService;

    @PostMapping("/submitOrder")
    @ApiOperation("预约")
    public Result submitOrder(@RequestBody MemberDTO memberDTO){
        orderService.submitOrder(memberDTO);
        return new Result(true,"预约成功",memberDTO.getId());
    }
    @PostMapping("/findById")
    @ApiOperation("根据id查询预约")
    public Result findById(@RequestParam Integer id){
        MemberVO member = orderService.findById(id);
        return new Result(true,"查询成功",member);
    }

}
